package controll;

import entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import sun.misc.Contended;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {
    /*@RequestMapping("/login.do")
    public String checkLogin(User user) {
        System.out.println(user.getName() + "\t" + user.getPassword());
        return "index";
    }*/
    @RequestMapping("/log.do")
    public String checkLogin2(HttpServletRequest request, Model model) {
        String name = request.getParameter("name");
        String pwd = request.getParameter("password");
        User u = new User();
        u.setName(name);
        u.setPassword(pwd);
        model.addAttribute("us",u);
        return "index";
    }
}
